package com.manage.project.biz.controller;
import java.util.List;
import com.manage.common.utils.poi.ExcelUtil;
import com.manage.framework.aspectj.lang.annotation.Log;
import com.manage.framework.aspectj.lang.enums.BusinessType;
import com.manage.framework.web.controller.BaseController;
import com.manage.framework.web.domain.AjaxResult;
import com.manage.framework.web.page.TableDataInfo;
import com.manage.project.biz.domain.Gongpeidian;
import com.manage.project.biz.domain.Zhaoming;
import com.manage.project.biz.service.IZhaomingService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 【请填写功能名称】Controller
 *
 * @author ruoyi
 * @date 2022-06-01
 */
@RestController
@RequestMapping("/biz/zhaoming")
public class ZhaomingController extends BaseController
{
    @Autowired
    private IZhaomingService zhaomingService;

    /**
     * 查询【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('biz:zhaoming:list')")
    @GetMapping("/list")
    public TableDataInfo list(Zhaoming zhaoming)
    {
        startPage();
        List<Zhaoming> list = zhaomingService.selectZhaomingList(zhaoming);
        return getDataTable(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */
//    @Log(title = "供配电设施", businessType = BusinessType.EXPORT)
////    @GetMapping("/export")
////    public AjaxResult export(Gongpeidian gongpeidian)  {
////        List<Gongpeidian> list = gongpeidianService.selectGongpeidianList(gongpeidian);
////        ExcelUtil<Gongpeidian> util = new ExcelUtil<Gongpeidian>(Gongpeidian.class);
////        return util.exportExcel(list, "供配电设施数据");
////    }
    @Log(title = "照明设施", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Zhaoming zhaoming)  {
        List<Zhaoming> list = zhaomingService.selectZhaomingList(zhaoming);
        ExcelUtil<Zhaoming> util = new ExcelUtil<Zhaoming>(Zhaoming.class);
        return util.exportExcel(list, "照明数据");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('biz:zhaoming:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(zhaomingService.selectZhaomingById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('biz:zhaoming:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Zhaoming zhaoming)
    {
        return toAjax(zhaomingService.insertZhaoming(zhaoming));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('biz:zhaoming:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Zhaoming zhaoming)
    {
        return toAjax(zhaomingService.updateZhaoming(zhaoming));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('biz:zhaoming:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(zhaomingService.deleteZhaomingByIds(ids));
    }
}
